<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
      rowKey="sysCode"
      defaultEventKey="entryTable"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      defaultEventKey="entryTable"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('detials', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <!-- 明细弹出框 -->
    <details-dialog ref="detailsDialog" :dictMap="dictMap" :formData.sync="formData"></details-dialog>
  </div>
</template>
<script>
import { apiUrlConfig, detailsQuery } from "@/api/cnaps/ccms/805/force_offline_notification_query.js";
import DetailsDialog from "./components/forceOfflineDetails";
import { listPageMixin } from "@/libs/listPageMixin";

export default {
  name: "ForceOfflineNotificationQuery",
  mixins: [listPageMixin],
  components: {
    DetailsDialog,
  },
  data() {
    return {
      reqConfig: apiUrlConfig,
      //数据字典
      searchFormDictList: ["SYS_CODE", "SYSTEMSTATUS", "HOLIDAYFLAGCODE"],
      //  明细弹框数据
      // form表单字段
      formData: {},
      showSearch: true,
      // 查询参数
      queryParams: {
        rcvTimeMin: "",
        rcvTimeMax: "",
      },
      formOptions: [],
      tableBindColumns: [
        { label: `交易流水号`, prop: "id", align: "center" },
        {
          label: `直接发送参与机构`,
          prop: "directSender",
          align: "center",
        },
        {
          label: `直接接收参与机构`,
          prop: "directRecver",
          align: "center",
        },
        {
          label: `系统编号`,
          prop: "sysCode",
          align: "center",
          dictCode: "SYS_CODE",
        },
        {
          label: `报文接收时间`,
          prop: "rcvTime",
          align: "center",
          type: "date",
        },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "dates",
        nameObj: {
          startTimeName: "rcvTimeMin",
          endTimeName: "rcvTimeMax",
        },
        defaultAttr: {
          label: "报文接收日期",
          placeholder: ["请输入起始日期", "请输入截止日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
    ];
  },
  methods: {
    /** 明细按钮操作 */
    handleAction(type, row = {}) {
      switch (type) {
        case "detials":
          // 明细信息
          detailsQuery(row).then((res) => {
            this.formData = res.result;
          });
          this.$refs.detailsDialog.show();
          break;
      }
    },
  },
};
</script>
